package queue;

import java.util.LinkedList;
import java.util.Queue;

//                                     队列
public class Test1 {
    public static void main(String[] args) {
        //三个方法
        //1.入队列 offer              2.取队首元素 peek          3.出队列 poll
        Queue<Integer> queue = new LinkedList<>();
        queue.offer(1);
        queue.offer(2);
        queue.offer(3);
        queue.offer(4);
        System.out.println(queue.peek());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        //判断队列是否为空
        if (queue.peek() == null){
            //.........
        }
    }
}
